package com.chen.port;

import java.net.InetSocketAddress;

public class SocketTest {
    public static void main(String[] args) {

        InetSocketAddress inetSocketAddress = new InetSocketAddress("127.0.0.1", 8080);
        InetSocketAddress inetSocketAddress2 = new InetSocketAddress("localhost", 8080);

        System.out.println(inetSocketAddress);
        System.out.println(inetSocketAddress.getAddress());// 地址
        System.out.println(inetSocketAddress.getHostName());// 主机名
        System.out.println(inetSocketAddress.getPort());// 端口

        System.out.println("=================");

        System.out.println(inetSocketAddress2);
        System.out.println(inetSocketAddress2.getAddress());// 地址
        System.out.println(inetSocketAddress2.getHostName());// 主机名
        System.out.println(inetSocketAddress2.getPort());// 端口


    }
}
